package cn.merryyou.logback.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @Author: gongtao
 * @Date: Created in 2018/6/3 09:44
 * @Description: Druid 数据库连接池属性实体类，通过读取application.yml中以 druid 为前缀的属性并注入到实体属性中
 */

@ConfigurationProperties(prefix = "druid")  // 获取在配置文件中druid前缀的属性，并注入到实体属性中
public class DruidProperties {


    private String url;             // 连接数据库的url
    private String username;
    private String password;
    private String driverClass;     // 数据库驱动类，可以不配置，druid可以通过 url 自动识别数据库类型选择相应的 driverClassName
    private int maxActive;          // 最大连接池数量
    private int minIdle;            // 已不再使用
    private int initialSize;        // 初始化时建立物理连接的数量
    private boolean testOnBorrow;   // 申请连接时执行检测连接是否有效
    private String filters;         // 配置监控统计拦截的filters，去掉后监控界面sql无法统计，'wall'用于防火墙

    public String getFilters() {
        return filters;
    }

    public void setFilters(String filters) {
        this.filters = filters;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDriverClass() {
        return driverClass;
    }

    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    public int getMaxActive() {
        return maxActive;
    }

    public void setMaxActive(int maxActive) {
        this.maxActive = maxActive;
    }

    public int getMinIdle() {
        return minIdle;
    }

    public void setMinIdle(int minIdle) {
        this.minIdle = minIdle;
    }

    public int getInitialSize() {
        return initialSize;
    }

    public void setInitialSize(int initialSize) {
        this.initialSize = initialSize;
    }

    public boolean isTestOnBorrow() {
        return testOnBorrow;
    }

    public void setTestOnBorrow(boolean testOnBorrow) {
        this.testOnBorrow = testOnBorrow;
    }
}
